package xyf.p10.dp;

/**
 * ClassName: P0300_LongestUpSeq
 * Description:
 * Author: xyf
 * Date: 9/9/22 10:31 AM
 * Version: 1.0
 **/
public class P0300_LongestUpSeq
{
    public int lengthOfLIS(int[] nums)
    {
        int[] dp = new int[nums.length];

        dp[0] = 1;

        for (int i = 1; i < nums.length; i++)
        {
            dp[i] = 1;
            for (int j = 0; j < i; j++)
            {
                if (nums[i] > nums[j])
                {
                    dp[i] = Math.max(dp[i], dp[j] + 1);
                }
            }
        }

        int max = 0;
        for (int i = 0; i < nums.length; i++)
        {
            max = Math.max(max, dp[i]);
        }
        return max;
    }
}